<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>通辽航空管理系统 | 登录</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <style>
        :root {
            --primary-blue: #2980b9;
            --primary-purple: #8e44ad;
        }

        /* 页面背景 */
        body {
            background: url('img/login_background.png') no-repeat center center fixed;
            background-size: cover;
            min-height: 100vh;
            padding-top: 80px;
        }

        /* 更透明的导航栏 */
        .main-navbar {
            background: rgba(255, 255, 255, 0.75) !important; /* 透明度从0.85改为0.75 */
            backdrop-filter: blur(12px); /* 增加模糊度 */
            box-shadow: 0 2px 15px rgba(0,0,0,0.1);
            border-bottom: 1px solid rgba(255,255,255,0.2); /* 更明显的底部边框 */
        }

        /* 导航栏内容布局 */
        .brand-wrapper {
            display: flex;
            align-items: center;
            gap: 20px;
            margin-left: 2rem;
        }
        .brand-logo {
            width: 50px;
            height: 50px;
            border-radius: 50%;
            object-fit: cover;
            border: 2px solid var(--primary-blue);
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        }
        .brand-text {
            font-size: 1.8rem;
            font-weight: 600;
            color: var(--primary-blue);
            text-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }

        /* 注册按钮 */
        .nav-register-btn {
            margin-right: 2rem;
            border-radius: 25px;
            padding: 8px 25px;
            font-weight: 500;
            transition: all 0.3s;
            border: 2px solid var(--primary-blue);
            background: rgba(255,255,255,0.9);
        }
        .nav-register-btn:hover {
            background: var(--primary-blue);
            color: white !important;
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(41,128,185,0.3);
        }

        /* 登录卡片 */
        .login-container {
            display: flex;
            align-items: center;
            justify-content: center;
            min-height: calc(100vh - 160px);
        }
        .login-card {
            background: rgba(255, 255, 255, 0.85) !important;;
            border-radius: 20px;
            box-shadow: 0 15px 30px rgba(0,0,0,0.15);
            width: 100%;
            max-width: 500px;
            padding: 2rem;
            backdrop-filter: blur(8px);
            border: 1px solid rgba(255,255,255,0.4);
        }

        /* 表单元素 */
        .nav-tabs { border: none; }
        .nav-link {
            font-size: 1.1rem;
            color: #666;
            border: none !important;
            transition: all 0.3s;
        }
        .nav-link.active {
            color: #fff !important;
            background: var(--primary-blue) !important;
            border-radius: 30px;
            background: rgba(41, 128, 185, 0.9) !important;
        }
        .form-control {
            border-radius: 30px;
            padding: 15px 25px;
            transition: all 0.3s;
            background: rgba(255,255,255,0.9); /* 输入框半透明 */
        }
        .form-control:focus {
            box-shadow: 0 0 0 3px rgba(41, 128, 185, 0.25);
        }
        .login-btn {
            border-radius: 30px;
            padding: 15px 30px;
            font-weight: 600;
            letter-spacing: 1px;
        }
    </style>
</head>
<body>
    <nav class="main-navbar navbar navbar-expand-lg fixed-top">
        <div class="container-fluid px-4">
            <div class="brand-wrapper">
                <img src="img/logo.jpg" alt="航空管理系统" class="brand-logo">
                <span class="brand-text">通辽航空管理系统</span>
            </div>
            <div class="d-flex align-items-center">
                <a href="user_register.jsp" class="btn nav-register-btn">
                    ✈️ 立即注册
                </a>
            </div>
        </div>
    </nav>

    <div class="login-container">
        <div class="login-card">
            <ul class="nav nav-tabs nav-fill mb-4">
                <li class="nav-item">
                    <a class="nav-link active" id="user-tab">乘客登录</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" id="admin-tab">管理员登录</a>
                </li>
            </ul>

            <form id="userForm" action="UserLoginServlet" method="post" style="display: block;">
                <div class="mb-3">
                    <input id="phone"
                           type="tel" 
                           class="form-control" 
                           name="phone" 
                           placeholder="📱 请输入手机号码"
                           pattern="1[3-9]\d{9}"
                           required>
                </div>
                <div class="mb-4">
                    <input id="password"
                           type="password" 
                           class="form-control" 
                           name="password" 
                           placeholder="🔒 请输入密码"
                           required>
                </div>
                <button type="submit" class="btn btn-primary w-100 login-btn">乘客登录</button>
            </form>

            <form id="adminForm" action="AdminLoginServlet" method="post" style="display: none;">
                <div class="mb-3">
                    <input id="name"
                           type="text" 
                           class="form-control" 
                           name="name" 
                           placeholder="👤 管理员姓名"
                           required>
                </div>
                <div class="mb-4">
                    <input id="password"
                           type="password" 
                           class="form-control" 
                           name="password" 
                           placeholder="🔒 管理员密码"
                           required>
                </div>
                <button type="submit" class="btn btn-danger w-100 login-btn">管理员登录</button>
            </form>
        </div>
    </div>

    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <script>
        $(document).ready(function(){
            // 切换登录表单
            $('#user-tab').click(function(){
                $('#userForm').show();
                $('#adminForm').hide();
                $('.nav-link').removeClass('active');
                $(this).addClass('active');
            });

            $('#admin-tab').click(function(){
                $('#userForm').hide();
                $('#adminForm').show();
                $('.nav-link').removeClass('active');
                $(this).addClass('active');
            });

            // 手机号输入验证
            $('input[name="phone"]').on('input', function(){
                this.setCustomValidity(/^1[3-9]\d{9}$/.test(this.value) ? '' : '请输入有效的手机号码');
            });
        });
    </script>
</body>
</html>